﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BenevolentSunData
{
    public enum Direction
    {
        North = 0,
        South = 1,
        East = 2,
        West = 3
    }
    
    public static class DirectionUtils
    {
        public static Direction Invert(Direction d)
        {
            switch (d)
            {
                case Direction.North:
                    return Direction.South;
                case Direction.South:
                    return Direction.North;
                case Direction.East:
                    return Direction.West;
                case Direction.West:
                    return Direction.East;
                default:
                    throw (new Exception("Unknown direction: " + d));
            }
        }

        public static Direction[] Directions = { Direction.North, Direction.South, Direction.East, Direction.West };

        public static Orientation Invert(Orientation o)
        {
            if (o == Orientation.NorthSouth)
                return Orientation.EastWest;
            return Orientation.NorthSouth;
        }

        public static bool IsInOrientation(Orientation o, Direction d)
        {
            if (o == Orientation.NorthSouth && (d == Direction.North || d == Direction.South))
            {
                    return true;
            }
            else if (o == Orientation.EastWest && (d == Direction.East || d == Direction.West))
            {
                    return true;
            }
            return false;
        }
    }

    public enum Orientation
    {
        NorthSouth,
        EastWest
    }

}
